<template>
  <div v-if="show" class="appreciation-mask" @click.self="$emit('close')">
    <div class="appreciation-modal">
      <div class="title"><i class="ri-hand-coin-line"></i> 赞赏作者</div>
      <div class="qrcode-box">
        <img
          src="https://cdn.jsdelivr.net/gh/tsundoku-lab/cdn-assets/blog/donate-qr.png"
          alt="打赏二维码"
        />
      </div>
      <div class="desc">感谢您的支持！</div>
      <button class="close-btn" @click="$emit('close')"><i class="ri-close-line"></i></button>
    </div>
  </div>
</template>

<script setup>
defineProps({ show: Boolean })
</script>

<style lang="scss" scoped>
.appreciation-mask {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.appreciation-modal {
  background: var(--bg-color);
  border-radius: 16px;
  padding: 32px 32px 24px 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  min-width: 260px;
  min-height: 260px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    i {
      font-size: 22px;
    }
  }
  .qrcode-box {
    width: 160px;
    height: 160px;
    background: var(--bg-color-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    img {
      width: 140px;
      height: 140px;
      object-fit: contain;
      border-radius: 8px;
    }
  }
  .desc {
    color: var(--text-color-secondary);
    font-size: 15px;
    margin-bottom: 8px;
  }
  .close-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    background: none;
    border: none;
    color: var(--text-color-secondary);
    font-size: 22px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
    &:hover {
      background: var(--primary-color-light-10);
      color: var(--primary-color);
    }
  }
}
@media (max-width: 600px) {
  .appreciation-modal {
    padding: 16px 4px 12px 4px;
    min-width: 180px;
    .qrcode-box {
      width: 100px;
      height: 100px;
      img {
        width: 90px;
        height: 90px;
      }
    }
    .title {
      font-size: 15px;
    }
    .desc {
      font-size: 13px;
    }
  }
}
</style>
